]> dgit.raspbian.org Git - gnome-shell.git/commit
edge-drag-gesture: Small improvements to gesture detection
authorJonas Dreßler <verdre@v0yd.nl>
Fri, 25 Jul 2025 10:31:36 +0000 (12:31 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 28 Aug 2025 17:14:06 +0000 (19:14 +0200)
commitc66372c9a03ae3e677860aa102c448fa19d06a36
tree46738ed50e6b979c7827aace906e8883d52d975f
parentcef149a6afd4e70465700db0825bd4e7ca14e4ff
edge-drag-gesture: Small improvements to gesture detection

Just a few small improvements to the accuracy of detection that came up
while porting to ClutterGesture.

- Use a fixed CANCEL_THRESHOLD instead of comparing the moved distance to
the perpendicular direction distance. Comparing to the perpendicular
distance means the point is basically allowed to travel in a max 45 degree
angle from the screen edge. Our EDGE_THRESHOLD is quite small though (20),
so after the gesture begins to recognize, it's surprisingly easy to
unwillingly cancel the gesture (just needs to move 20 pixels in the
perpendicular direction). Instead simply go with a fixed threshold for
cancelling the gesture. This has the additional upside that we'll also
move the state to CANCELLED if the gesture didn't move to RECOGNIZING
beforehand, a behavior that ClutterGesture strongly encourages.

- Introduce a cancel timeout of 200 ms, so that the gesture is cancelled
if it point is still hovering at the monitor edge for a while. The timeout
should be fairly short, as this gesture can happen on top of an application
window, and the application can't use the event until the gesture has moved
to CANCELLED, so we don't want to keep the event to ourselves for too
long.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2853>
src/shell-edge-drag-gesture.c